 
 <#-- 
 
 creates a sentence for every table in sql server...
 
 
 -->
<#-- variables used internally by the generator... -->
<#assign nameFile="sql">
<#assign extensionFile="sql">
<#assign languageGenerated="sql">
<#assign description="sql">
<#assign targetDirectory="sql">
<#assign appliesToAllTables="true">
<#-- END variables used internally by the generator... -->


/* Delete all tables...	*/
/* --------------------	*/
/* 
<#list project.getTables() as tablita> 
        delete ${tablita}		
</#list>
*/
	
<#list project.getTables() as tablita>
	/* Table structure for table '${tablita}'	*/
	/* -------------------------------------	*/

	CREATE TABLE "${tablita}" (
	 
		<#list tablita.getFields() as field>
		 
			 <#-- segun el tipo de campo...   -->
			 <#switch field.getType()>
				  <#case "_int">
					 <#if (field.getisKey())>
						   [${field}] [int] IDENTITY(1,1) NOT NULL,
						<#else>
							 [${field}] [int] NULL default (0),
					</#if>
					<#break>
				  <#case "_string">
					<#if (field.getSize() == 1)>
							[${field}] [char](1) COLLATE Modern_Spanish_CI_AS NULL default (''),
						<#else>
							 [${field}] [varchar](${field.getSize()}) COLLATE Modern_Spanish_CI_AS NULL,
					</#if>
					
					 <#break>
				  <#case "_date">
					[${field}] [datetime] NULL,
					 <#break>
				  <<#case "_boolean">
					[${field}] [bit] NULL DEFAULT ((0)),
					 <#break>
				  <#default>
					[${field}] [varchar](${field.getSize()}) COLLATE Modern_Spanish_CI_AS NULL,			    
			</#switch>  
		</#list>		
		PRIMARY KEY  (${tablita.getListOnlyKeyFields()}),
		 
	);
	
</#list>


 


